SET(SRC bdb_svc.c
	store.c
	rtserver.c
	)

ADD_DEFINITIONS(-D_LARGEFILE64_SOURCE -O2 -Wall)
SET(CMAKE_C_FLAGS_DEBUG "$ENV{CFLAGS} -O0 -Wall -g  -ggdb")
SET(CMAKE_C_FLAGS_RELEASE "$ENV{CFLAGS} -O3 -Wall")


SET(APR_DIR /usr/local/apr)
SET(APR_UTIL_DIR /usr/local/apr)
SET(BERKELEY_DB_DIR /usr/local/BerkeleyDB.4.7)
SET(ZEVENT_DIR /usr/local/zevent)
#SET(RTINFOSERVER_SOURCE_DIR )

#MESSAGE(STATUS "dir:${PROJECT_SOURCE_DIR}")
SET(INC_DIRS ${APR_DIR}/include/apr-1 ${APR_UTIL_DIR}/include/apr-1 ${BERKELEY_DB_DIR}/include 
	${ZEVENT_DIR}/include ${PROJECT_SOURCE_DIR}/include)

INCLUDE_DIRECTORIES(${INC_DIRS})

SET(LINK_DIRS ${APR_DIR}/lib ${APR_UTIL_DIR}/lib ${BERKELEY_DB_DIR}/lib ${ZEVENT_DIR}/lib)
LINK_DIRECTORIES(${LINK_DIRS})

SET(ZEVENT_LIB zevent)
SET(APR_LIB apr-1)
SET(APR_UTIL_LIB aprutil-1)
SET(BERKELEY_DB_LIB db)

ADD_EXECUTABLE(rtserver ${SRC})

TARGET_LINK_LIBRARIES(rtserver ${APR_LIB} ${APR_UTIL_LIB} ${BERKELEY_DB_LIB} ${ZEVENT_LIB})

INSTALL(TARGETS rtserver RUNTIME DESTINATION bin
	LIBRARY DESTINATION bin)

